#pragma once
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <string>
#include <unistd.h>
#include <fcntl.h>
using namespace std;

const string gpipefile = "./fifo"; // 公共文件
const mode_t gmode = 0600;
const int gdeafultfd = -1; // 默认fd
const int gsize = 1024;    // 默认缓冲区大小

const int gForRead = O_RDONLY;
const int gForWrite= O_WRONLY;

int OpenPipe(int flag)
{
    int fd = ::open(gpipefile.c_str(), flag);
    if (fd < 0)
    {
        cerr << "open fail" << endl;
    }
    return fd;
}

void ClosePipeHelper(int fd)
{
    if (fd >= 0)
        ::close(fd);
}


